package cn.gson.crmdemo.controller.sale;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import cn.gson.crmdemo.model.service.SalesOpportunityService;

@Controller
public class SaleOpportunityConreoller {
	@Autowired
	SalesOpportunityService soe;
	/**
	 * 销售机会
	 */
	@RequestMapping("select-All")
	@ResponseBody
	public Map<String, Object> selectSalesAll( Integer pageNum, Integer pageSize) {
		Page<Object> page = PageHelper.startPage(pageNum, pageSize);
		// 当前页的内容
		JSONArray list = soe.selectcx();
		// 总记录数
		long total = page.getTotal();
		Map<String, Object> map = new HashMap<>();
		map.put("list", list);
		map.put("total", total);
		return map;
	}
}
